package com.imay.live.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.imay.live.helper.SystemNoticeHelper;
import com.imay.live.model.SystemNoticeModel;
import com.imay.live.utils.TimeUtil;
import com.imay.live.R;

import java.util.List;

/**
 * Created by  nick on 2017/4/26 0026.
 * 我的-系统消息-消息详情
 */

public class SystemNoticeDetailAdapter extends BaseQuickAdapter<SystemNoticeModel,BaseViewHolder> {

    public SystemNoticeDetailAdapter(List<SystemNoticeModel> data) {
        super(R.layout.item_system_notice_detail,data);
    }

    @Override
    protected void convert(BaseViewHolder helper, SystemNoticeModel item) {
        helper.setText(R.id.tv_time_chat_text_right, TimeUtil.getFormatTime(item.getCreateTime()));
        int imageId = SystemNoticeHelper.getIconByType(item.getContentType());
        if (imageId!=0){
            helper.setBackgroundRes(R.id.iv_head_img_chat_text_right,imageId);
        }else{
            helper.setBackgroundRes(R.id.iv_head_img_chat_text_right,R.mipmap.placeholder);
        }
        if (item.getContentId()==0) {
            helper.setText(R.id.tv_content_chat_text_left, item.getContent());
        }else{
            helper.setText(R.id.tv_content_chat_text_left, SystemNoticeHelper.getContent(mContext,item.getContentType(), (int) item.getContentId(),item.getContentParameters()));
        }

    }
}
